import { defineStore } from 'pinia'
import { ref } from 'vue'
//用户模块 token setToken removeToken

export const useUserStore = defineStore('user',() => {
  //全局状态
    const token = ref(null);
    //设置token
    const setToken = (newToken) => {
      token.value = newToken;
    };
    //移除token
    const removeToken = () => {
      token.value = null;
    };

    return { token,setToken,removeToken };
  },
  { 
    persist: true,
  },
);